package com.ibm.interfaces;

import java.util.Collection;
import java.util.HashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.google.common.base.Preconditions;
import com.google.gson.JsonArray;
import com.google.gson.JsonParser;
import com.ibm.cps.message.MessageFields;
import com.ibm.cps.message.ParsedDataMessage;
import com.ibm.cps.message.RawDataMessage;
import com.ibm.util.Constants;
import com.ibm.util.DataTypes;
import com.ibm.util.ErrorCode;
import com.ibm.util.JSONUtility;
import com.ibm.util.exception.CPSException;


/**
 * @author Yaoliang Chen
 * @version Jun 12, 2014 TODO P1 add version support 
 * 		[fixed] a little wierd for
 *          the combination of get and bind in the same class
 */
public interface IMessageParser {
	

	/**
	 * get the time series key without parsing the full message.
	 * 
	 * @param data
	 * @return
	 * @throws CPSException
	 */
	public abstract Comparable getTimeSeriesKey(byte[] data) throws CPSException;

	/**
	 * parse the data message
	 * 
	 * @param message
	 * @return
	 * @throws CPSException
	 */
	public abstract ParsedDataMessage parseDataMessage(RawDataMessage message)
			throws CPSException;

	/**
	 * get bytes from the parsed data message
	 * 
	 * @param message
	 * @return
	 * @throws CPSException
	 */
	public abstract byte[] restoreFromDataMessage(ParsedDataMessage message)
			throws CPSException;
	
	public abstract ITimeSeriesSchema getSchema();
}
